package com.sc.nft.admin.controller;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dto.IdRequest;
import com.sc.nft.feign.WxMiniPopUpClient;
import com.sc.nft.req.popup.PopUpReq;
import com.sc.nft.req.popup.PopUpWebGetReq;
import com.sc.nft.sup.Result;
import com.sc.nft.vo.popup.PopUpDetailsVO;
import com.sc.nft.vo.popup.PopUpWebGetVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/wxMiniMall/popUp")
@Api(tags = "小程序弹窗")
public class WxMiniPopUpController{

    private final WxMiniPopUpClient wxMiniPopUpService;

    /**
     * 保存小程序弹窗
     * @param request
     * @return
     */
    @PostMapping(value = "/create", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "保存小程序弹窗")
    @SysMemberLogin
    public Result savePopUp(@Valid @RequestBody PopUpReq request) {
        return wxMiniPopUpService.savePopUp(request);
    }

    /**
     * 小程序弹窗详情
     * @return
     */
    @PostMapping(value = "/details", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "小程序弹窗详情")
    @SysMemberLogin
    public Result<PopUpDetailsVO> detailsPopUp() {
        return wxMiniPopUpService.detailsPopUp();
    }

    /**
     * 启用小程序弹窗
     * @param request
     * @return
     */
    @PostMapping(value = "/enable", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "启用小程序弹窗")
    @SysMemberLogin
    public Result enable(@RequestBody IdRequest request) {
        return wxMiniPopUpService.enable(request);
    }

    /**
     * 关闭小程序弹窗
     * @param request
     * @return
     */
    @PostMapping(value = "/disable", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "关闭小程序弹窗")
    @SysMemberLogin
    public Result disable(@RequestBody IdRequest request) {
        return wxMiniPopUpService.disable(request);
    }




}